// TaskExecutor.h
#pragma once
#include "ThreadPool.h"
#include <memory>
#include <future>

class TaskExecutor {
public:
    explicit TaskExecutor(size_t numThreads = std::thread::hardware_concurrency());
    ~TaskExecutor();

    template<typename Func, typename... Args>
    auto submit(Func&& f, Args&&... args) -> std::future<decltype(f(args...))> {
        return pool->enqueue(std::forward<Func>(f), std::forward<Args>(args)...);
    }

private:
    std::unique_ptr<ThreadPool> pool;
};
